// Copyright (c) 2020 Presto Labs Pte. Ltd.
// Author: xguo

#pragma once

#include <functional>
#include <map>
#include <string>
#include <vector>

namespace coin2::exchange::base::order {

// This one only used for passing account_id (huobi) / listen_key (binance),
// not needed in the futures. Will be removed later.
class MessageBus {
 public:
  using Callback = std::function<void(const std::string&, void*)>;

 public:
  MessageBus() = default;
  ~MessageBus() = default;

  // Not serialization needed.
  void PublishEvent(const std::string&, void* event_data);
  void Subscribe(const std::string&, const Callback&);
  bool has_channel(const std::string&) const;

 private:
  std::map<std::string, std::vector<Callback>> channel_map_;
};

}  // namespace coin2::exchange::base::order
